﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.72    贷款产品信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_SYS_PRODUCT: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_SYS_PRODUCT()
		{}
		#region Model
		private long _id;
		private string _productno;
		private string _productname;
		private int _intcycle;
		private decimal _rate;
		private decimal _managerate;
		private decimal _feerate;
		private int _payment;
		private int _parm1;
		private int _parm2;
		private int _isholiday=0;
		private int _systemid;
		private long _salesrptid;
		private long _riskrptid;
		private long _metinfosetid;
		private int _status=1;
		private string _remark;
        private string _createBy;
        private DateTime? _createDate;
        private string _modifyBy;
        private DateTime? _modifyDate;

		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 产品编码
		/// </summary>
		[DataMember]
		public string PRODUCTNO
		{
			get{return _productno;}
			set{
				if ( _productno!= value)
				{
					 _productno = value;
					OnPropertyChanged("PRODUCTNO");
				}
			}
		}
		/// <summary>
		/// 产品名称
		/// </summary>
		[DataMember]
		public string PRODUCTNAME
		{
			get{return _productname;}
			set{
				if ( _productname!= value)
				{
					 _productname = value;
					OnPropertyChanged("PRODUCTNAME");
				}
			}
		}
		/// <summary>
		/// 结息周期1年2季3月4日
		/// </summary>
		[DataMember]
		public int INTCYCLE
		{
			get{return _intcycle;}
			set{
				if ( _intcycle!= value)
				{
					 _intcycle = value;
					OnPropertyChanged("INTCYCLE");
				}
			}
		}
		/// <summary>
		/// 贷款利率以%号显示
		/// </summary>
		[DataMember]
		public decimal RATE
		{
			get{return _rate;}
			set{
				if ( _rate!= value)
				{
					 _rate = value;
					OnPropertyChanged("RATE");
				}
			}
		}
		/// <summary>
		/// 管理费率以%号显示
		/// </summary>
		[DataMember]
		public decimal MANAGERATE
		{
			get{return _managerate;}
			set{
				if ( _managerate!= value)
				{
					 _managerate = value;
					OnPropertyChanged("MANAGERATE");
				}
			}
		}
		/// <summary>
		/// 手续费率
		/// </summary>
		[DataMember]
		public decimal FEERATE
		{
			get{return _feerate;}
			set{
				if ( _feerate!= value)
				{
					 _feerate = value;
					OnPropertyChanged("FEERATE");
				}
			}
		}
		/// <summary>
		/// 还款方式参考“还款方式”文档
		/// </summary>
		[DataMember]
		public int PAYMENT
		{
			get{return _payment;}
			set{
				if ( _payment!= value)
				{
					 _payment = value;
					OnPropertyChanged("PAYMENT");
				}
			}
		}
		/// <summary>
		/// 立项计算参数11按贷款金额计息，2按本金余额计息
		/// </summary>
		[DataMember]
		public int PARM1
		{
			get{return _parm1;}
			set{
				if ( _parm1!= value)
				{
					 _parm1 = value;
					OnPropertyChanged("PARM1");
				}
			}
		}
		/// <summary>
		/// 立项计算参数21算头不算尾，2算头又算尾
		/// </summary>
		[DataMember]
		public int PARM2
		{
			get{return _parm2;}
			set{
				if ( _parm2!= value)
				{
					 _parm2 = value;
					OnPropertyChanged("PARM2");
				}
			}
		}
		/// <summary>
		/// 利息计算考虑节假日0不考虑，1考虑，默认为0
		/// </summary>
		[DataMember]
		public int ISHOLIDAY
		{
			get{return _isholiday;}
			set{
				if ( _isholiday!= value)
				{
					 _isholiday = value;
					OnPropertyChanged("ISHOLIDAY");
				}
			}
		}
		/// <summary>
		/// 对应子系统1典当，2信贷，3担保
		/// </summary>
		[DataMember]
		public int SYSTEMID
		{
			get{return _systemid;}
			set{
				if ( _systemid!= value)
				{
					 _systemid = value;
					OnPropertyChanged("SYSTEMID");
				}
			}
		}
		/// <summary>
		/// 项目经理报告
		/// </summary>
		[DataMember]
		public long SALESRPTID
		{
			get{return _salesrptid;}
			set{
				if ( _salesrptid!= value)
				{
					 _salesrptid = value;
					OnPropertyChanged("SALESRPTID");
				}
			}
		}
		/// <summary>
		/// 风控经理报告
		/// </summary>
		[DataMember]
		public long RISKRPTID
		{
			get{return _riskrptid;}
			set{
				if ( _riskrptid!= value)
				{
					 _riskrptid = value;
					OnPropertyChanged("RISKRPTID");
				}
			}
		}
		/// <summary>
		/// 材料清单
		/// </summary>
		[DataMember]
		public long METINFOSETID
		{
			get{return _metinfosetid;}
			set{
				if ( _metinfosetid!= value)
				{
					 _metinfosetid = value;
					OnPropertyChanged("METINFOSETID");
				}
			}
		}
		/// <summary>
		/// 生效状态1生效、0失效，默认为1
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 产品说明
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}

        /// <summary>
        /// 建档人
        /// </summary>
        [DataMember]
        public string CREATEBY
        {
            get { return _createBy; }
            set
            {
                if (_createBy != value)
                {
                    _createBy = value;
                    OnPropertyChanged("CREATEBY");
                }
            }
        }

        /// <summary>
        ///建档时间
        /// </summary>
        [DataMember]
        public DateTime? CREATEDATE
        {
            get { return _createDate; }
            set
            {
                if (_createDate != value)
                {
                    _createDate = value;
                    OnPropertyChanged("CREATEDATE");
                }
            }
        }

        /// <summary>
        /// 修改人
        /// </summary>
        [DataMember]
        public string MODIFYBY
        {
            get { return _modifyBy; }
            set
            {
                if (_modifyBy != value)
                {
                    _modifyBy = value;
                    OnPropertyChanged("MODIFYBY");
                }
            }
        }

        /// <summary>
        /// 修改时间
        /// </summary>
        [DataMember]
        public DateTime? MODIFYDATE
        {
            get { return _modifyDate; }
            set
            {
                if (_modifyDate != value)
                {
                    _modifyDate = value;
                    OnPropertyChanged("MODIFYDATE");
                }
            }
        }

		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

